
#ifndef CNWIDGET_H
#define CNWIDGET_H

#include <QWidget>
#include <QLabel>
#include <QTextEdit>

QT_BEGIN_NAMESPACE
class QDragEnterEvent;
class QDropEvent;
QT_END_NAMESPACE

class CNWidget : public QWidget
{
public:
    CNWidget(QWidget *parent = nullptr);
    QString getstring();

protected:
    void dragEnterEvent(QDragEnterEvent *event) override;
    void dropEvent(QDropEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void keyPressEvent(QKeyEvent *event) override;
    QList<QLabel *> mlist;

    void touchFile(const QString &targetFileName);

    int micurselkey;
    int miwith;
    int mibegin;
    int miend;
    int mireplacebegin;
    int mireplaceend;
    int mselecteditcn;

    int mpinyinnum;
    int mcinum;
    QString mbefore;

    QStringList mfiles;
    QStringList mfiledirs;
    QStringList mfileCis;
    QStringList mfileCisdirs;
    int mshowci;
    int mshowpinyin;
    void EditTextChanged();
    void deleteDragLabel();
    QTextEdit *medit;
    QString mlaststring;
    QLabel *createDragLabel(const QString &text, QWidget *parent);
    void PinYinZhiDir(const QString &str);
    void PinYinCiDir(const QString &dirstr);
    int ShowPinYin(int ipage,int iaddormad);
    int ShowCi(int ipage,int iaddormad);
    void SelectDragLabel(int inum);
    void CreateLink(const QString &filedir);


    void touch(QString qstrfile);
    void ln(QString qstrfilesrc,QString qstrfiledes);

};
#endif // DRAGWIDGET_H
